//
//  Open_MyViewController.m
//  OpenYooxi_IOS
//
//  Created by YeahYes on 15/3/16.
//  Copyright (c) 2015年 com.ivyvi.ee. All rights reserved.
//

#import "Open_MyViewController.h"
#import "WeiWanDingdan_CollectionViewCell.h"
#import "MyDingDanDe_ViewController.h"
#import "Myshoucangde_ViewController.h"

static NSString *identify = @"Cell";

@interface Open_MyViewController (){

    UICollectionViewFlowLayout *flowLayout;

    UITapGestureRecognizer *tap1;
    UITapGestureRecognizer *tap2;
    UITapGestureRecognizer *tap3;
    UITapGestureRecognizer *tap4;
    UITapGestureRecognizer *tap5;

}

@end

@implementation Open_MyViewController





- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.title = @"我的";
    
    _myView.backgroundColor = UIColorFromRGB(0xF1F2F6);
    self.view.backgroundColor = UIColorFromRGB(0xF1F2F6);

    _baomaImg.layer.borderColor = [UIColor whiteColor].CGColor;
    _baomaImg.layer.borderWidth = 1;
    
    
    //3.设置内容的尺寸
    _huadongscrollView.contentSize = CGSizeMake(kScreenWidth, kScreenHeight);
    //滚动时是否显示垂直方向的滚动条
    _huadongscrollView.showsVerticalScrollIndicator = NO;
    _huadongscrollView.backgroundColor = UIColorFromRGB(0xF1F2F6);
    
    
    
    
    
    
    
    
    //1.为当前UICollectionView对象，创建布局对象
    flowLayout = [[UICollectionViewFlowLayout alloc] init];
    //2.设置滑动方向
    flowLayout.scrollDirection = UICollectionViewScrollDirectionHorizontal;
    flowLayout.itemSize = CGSizeMake(80, 88);
    
    //3.minimumInteritemSpacing  水平方向单元格之间的最小间隙
    flowLayout.minimumLineSpacing = 0;
    flowLayout.minimumInteritemSpacing = 0;
    
    

    _dingdanconllectionview.collectionViewLayout = flowLayout;
    _dingdanconllectionview.dataSource = self;
    _dingdanconllectionview.delegate = self;
    _dingdanconllectionview.pagingEnabled = YES;  //分页
    _dingdanconllectionview.backgroundColor = [UIColor whiteColor];
    //取消UICollectionView下侧的滑动条  左右滑动时是：showsHorizontalScrollIndicator
    _dingdanconllectionview.showsHorizontalScrollIndicator = NO;
    
    //注册单元格类型
    UINib *nib = [UINib nibWithNibName:@"WeiWanDingdan_CollectionViewCell" bundle:[NSBundle mainBundle]];
    [_dingdanconllectionview registerNib:nib forCellWithReuseIdentifier:identify];

    
    /**我的订单手势添加*/
    tap1 = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tap1:)];;
    [_dingdanview addGestureRecognizer:tap1];
    
    /**我的收藏手势添加*/
    tap2 = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tap2:)];;
    [_shoucangview addGestureRecognizer:tap2];
    
    /**我的陶继宁手势添加*/

    tap3 = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tap3:)];;
    [_kaview addGestureRecognizer:tap3];
    
    /**我的积分手势添加*/
    tap4 = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tap4:)];;
    [_jifenview addGestureRecognizer:tap4];
    
    /**我的账户余额手势添加*/
    tap5 = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tap5:)];;
    [_yueview addGestureRecognizer:tap5];
    
}


#pragma mark - 手势的添加点击事件
- (void)tap1:(UITapGestureRecognizer *)tap {
    
    if(tap.state == UIGestureRecognizerStateEnded) {
        MyDingDanDe_ViewController *myding = [[MyDingDanDe_ViewController alloc] initWithNibName:@"MyDingDanDe_ViewController" bundle:nil];
        [self.navigationController pushViewController:myding animated:YES];
    }
}


- (void)tap2:(UITapGestureRecognizer *)tap {
    
    if(tap.state == UIGestureRecognizerStateEnded) {
        Myshoucangde_ViewController *shoucang = [[Myshoucangde_ViewController alloc] initWithNibName:@"Myshoucangde_ViewController" bundle:nil];
        [self.navigationController pushViewController:shoucang animated:YES];
    }
}


- (void)tap3:(UITapGestureRecognizer *)tap {
    
    if(tap.state == UIGestureRecognizerStateEnded) {
        
    }
}


- (void)tap4:(UITapGestureRecognizer *)tap {
    
    if(tap.state == UIGestureRecognizerStateEnded) {
        
    }
}


- (void)tap5:(UITapGestureRecognizer *)tap {
    
    if(tap.state == UIGestureRecognizerStateEnded) {
        
    }
}


#pragma mark - UICollectionView delegate
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
    return 13;
}

- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
    
    WeiWanDingdan_CollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:identify forIndexPath:indexPath];
    cell.contentView.backgroundColor = [UIColor clearColor];
    return cell;
}

#pragma mark -collectionView的代理方法点击触发
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
    MyLog(@"点击了collection");
}





- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
